import os
import pygame

def load_image(name, color_key = None):

        full_name = os.path.join('data', name)

        try:
            image = pygame.image.load(full_name)
        except (pygame.error, message):
            print ('Cannot load image:', name)
            raise (SystemExit, message)

        #image = image.convert()

        if color_key is not None:
            if color_key is -1:
                color_key = image.get_at((0,0))
            image.set_colorkey(color_key, RLEACCEL)

        return image
